extends StatusInterface
 
# 此怪物只会左右移动，并且遇到障碍物会反转
func _physics_process(_delta):
	# 是否转向
	var was_on_wall = owner.is_on_wall()
	owner.move_and_slide()
	
	if !was_on_wall && owner.is_on_wall():
		owner.direction *= -1
	
	#if not owner.is_on_floor():
		#manage_node.to_fall()

func _process(delta):
	owner.velocity.y += owner.gravity * delta 
	if owner.look_something() == 2:
		manage_node.to_run()
		return
		
	else:
		# 发现了悬崖转向
		if owner.look_falling():
			owner.direction *= -1
			
		owner.velocity.x = move_toward(owner.velocity.x, owner.max_speed * owner.direction, owner.acceleration * delta)

	owner.set_face_direction(owner.direction)

